﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

public partial class register : System.Web.UI.Page
{


    Encrypt encryptobj = new Encrypt();


    protected void Page_Load(object sender, EventArgs e)
    {

    }




    #region Button Event

    protected void btn_Save_Click(object sender, EventArgs e)
    {
        SaveRecord();
    }

    #endregion

    #region User Defined Function
    public void SaveRecord()
    {
        Hashtable hstbl1 = new Hashtable();
        hstbl1.Add("@UserName", txtname.Text);
        hstbl1.Add("@Email", txtemail.Text);
        string encryptpwd = encryptobj.EncryptSring(txtpwd.Text);

        hstbl1.Add("@Password", encryptpwd);
        hstbl1.Add("@MobileNo", txtmobile.Text);
        hstbl1.Add("@OfficeNo", null);
        hstbl1.Add("@DOB", txtDate.Text);
        hstbl1.Add("@Gender", rbtMale.Checked == true ? 1 : 0);
        hstbl1.Add("@DeliveryAddress", txtdeliver.Text);
        hstbl1.Add("@PermanentAddres", txtpermnt.Text);
        hstbl1.Add("@Avatar", null);
        hstbl1.Add("@PageName", "Register");

        Int64 intIdentity = DataAccessLayer.ReturnInsertDataCommand("GemsUser_InsertUpdate_SP", hstbl1);
        if (intIdentity > 0)
        {
            Response.Redirect("~/index.aspx?status=1", false);

        }
        else if (intIdentity == 0)
        {

            JSAlert.Show(Common.USERALREADYEXISTS);

            JSAlert.Show("User Already Exists");

        }
        //string a = Common.PAGESIZE;

    }
    #endregion

   
}
